#define ELEMENTS_PER_NODE 3

/*##### STRUCTS DECLERATIONS  #####*/

/*this struct represents a single student record: id and name
 */
typedef struct record{
	unsigned id;
	char *name;
}record;

/*every node has an array of 'ELEMENTS_PER_NODE records
 *and a pointer to the next node on the list
 */
struct node {
	record r[ELEMENTS_PER_NODE];
	struct node *next;
};

typedef struct node Node;

/*an abstraction for the list
 *holds a head and tail pointer of the list
 *makes the work with the list easier on certain cases
 */
struct my_list {
	Node *head;
	Node *tail;
};
typedef struct my_list my_list;

/*#####  PROTOTYPES  #####*/

/* this function initializes the list given to it
 * by simply marking both of it's pointers as NULL
 * which is how other functions know to refer to the list as empty 
 */
void initMyList(my_list *lst);

/* a function to use to free the mem. allocated by
 * the user of this file - clears both the char * allocations
 * and the Node * allocations
 */
void freeList(my_list *lst);

/* insert the id and name given as a new record to lst
 * uses retrieveRecord to determine if the record exists in the list
 * if not allocates the needed mem. for char * and Node *
 * returns 1 if insertion succeeded
 * returns 0 if the record already exists in lst
 */
int insertRecord(my_list *lst,unsigned id, char *name);

/*checks if id is in lst
 * returns 1 iff id is in lst
 */
char *retrieveRecord(my_list *lst, unsigned id);

/* deletes the record with id also frees
 * any mem. allocation for char * and if needed Node *
 * returns 1 if delete was successful
 * returns 0 if id is not in lst
 */
int deleteRecord(my_list *lst, unsigned id);

